import { v4 as uuidv4 } from 'uuid';

// 只需生成一次的uuid方法
export const getUUID = () => {
    // 首先获取localStorage本地存储的uuid
    let uuid = localStorage.getItem('UUID');
    if (!uuid) {
        uuid = uuidv4();
        // uuid在本地存储中没有获取到，生成一个
        localStorage.setItem('UUID', uuid)
    }
    return uuid
}